<!DOCTYPE html>
<!--
 * Copyright (c) 2010 The Chromium Authors. All rights reserved.  Use of this
 * source code is governed by a BSD-style license that can be found in the
 * LICENSE file.
-->
<html>
  <head>
	<script>
		chrome.extension.onRequest.addListener(
		  function(request, sender, sendResponse) {
		    //console.log(sender.tab ?
			//			"from a content script:" + sender.tab.url :
			//			"from the extension");
		    // Create a simple text notification:
			if (request.type == 'getvars') {
			  var response = {};
			  response.chatNotification = localStorage.chatNotification;
			  response.desktopNotification = localStorage.desktopNotification;
			  response.checkArea = localStorage.checkArea;
			  sendResponse(response);
			}
			if (request.type == 'email') {
			  var notification = webkitNotifications.createNotification(
			    'icon48.png',  // icon url - can be relative
			    'You have ' + request.inboxCount + ' new mail!',  // notification title
			    ''  // notification body text
			  );
			  notification.show();
			  setTimeout(function() {
			    notification.cancel();
			  }, 15000);
			}
			else if (request.type == 'chat') {
			   var notification = webkitNotifications.createNotification(
			    'icon48.png',  // icon url - can be relative
			    'You have a new Gtalk message!',  // notification title
			    ''  // notification body text
			  );
			  notification.show();
			  setTimeout(function() {
			    notification.cancel();
			  }, 15000);
			}
		  }
		);
	</script>
  </head>
  <body>
  </body>
</html>
